// 获取玩家喜欢的歌名页面

// 关闭VSCode非必要报错
// ignore_for_file: camel_case_types, use_build_context_synchronously, non_constant_identifier_names

import 'package:crazy_mita_problem_project/pages/get_player_favourite_song_page/end_if_player_input_correctly.dart';
import 'package:crazy_mita_problem_project/utils/my_buttons/my_button_confirmed.dart';
import 'package:flutter/material.dart';

class Pages_GetPlayerFavouritePerson extends StatefulWidget {
  const Pages_GetPlayerFavouritePerson({super.key});
  @override
  State<Pages_GetPlayerFavouritePerson> createState() => _Pages_GetPlayerFavouritePerson();
}

class _Pages_GetPlayerFavouritePerson extends State<Pages_GetPlayerFavouritePerson> with TickerProviderStateMixin{
  // 该文本控制器用于存储玩家最喜欢听的歌
  TextEditingController textcontroller_favourite_person=TextEditingController();  
  @override
  void initState ()    // 覆写父类构造函数
    {
      super.initState();
      // 等initState初始化完再显示对话框
    }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.purple.shade50,
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Container(
              height: 450,
              width: 750,
              decoration: BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadius.circular(20),
                boxShadow: [
                  BoxShadow(
                    color: Colors.grey.shade300.withValues(), // 阴影颜色
                    spreadRadius: 3, // 阴影扩散半径
                    blurRadius: 3, // 阴影模糊半径
                    offset: Offset(0, 1), // 阴影偏移量
                  ),
                ],
              ),
              child: Padding(
                padding: const EdgeInsets.only(left:100,right: 100),
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    Text(
                      "最喜欢的人是谁?",
                      style: TextStyle(
                        fontSize: 30,
                        fontWeight: FontWeight.bold,
                      ),
                    ),
                    const SizedBox(height: 40,),
                    TextField(
                      controller: textcontroller_favourite_person,
                      style: TextStyle(
                        fontSize: 20,
                      ),
                      decoration: InputDecoration(
                        contentPadding: EdgeInsets.symmetric(horizontal: 25,vertical: 20),   // 设置内容上下边距
                        border: OutlineInputBorder(    // 设置输入框总布局
                          borderRadius: BorderRadius.circular(12),    // 设置输入框总圆角大小
                        ),
                        enabledBorder: OutlineInputBorder(    // 设置输入框非聚焦时的显示状态
                          borderRadius: BorderRadius.circular(12), // 设置圆角
                          borderSide: BorderSide(
                            color: Colors.grey.shade300, // 非聚焦时的边框颜色
                            width: 2.0, // 非聚焦时的边框宽度
                          ),
                        ),
                        labelText: "请输入你的答案...",
                        labelStyle: TextStyle(   // 设置提示文本文字样式
                          fontSize: 20,
                        ),
                      ),
                    ),
                    const SizedBox(height: 60,),    // 设置控件间适当距离
                    SizedBox(
                      height: 60,
                      width: 550,
                      child: MyButton_Confirmed(
                        text: "下一个", 
                        onPressed: (){
                          if (textcontroller_favourite_person.text=="疯狂米塔")
                            {
                              Navigator.push(
                                context, 
                                MaterialPageRoute(
                                  builder: (context)=>Pages_EndIfInputCorrectly(),
                                ),
                              );
                            }
                        },
                      ),
                    ),
                  ],
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
